function InfoBox(opts) {
	google.maps.OverlayView.call(this);
	this.latlng_ = opts.latlng;
	this.map_ = opts.map;
	this.offsetVertical_ = -113;
	this.offsetHorizontal_ = -41;
	this.height_ = 85;
	this.width_ = 180;
	this.content_ = opts.content;
	this.setMap(this.map_);
}
InfoBox.prototype = new google.maps.OverlayView();
InfoBox.prototype.remove = function() {
	if (this.div_) {
		this.div_.parentNode.removeChild(this.div_);
		this.div_ = null;
	}
};
InfoBox.prototype.draw = function() {
	this.createElement();
	if (!this.div_)
		return;
	var pixPosition = this.getProjection().fromLatLngToDivPixel(this.latlng_);
	if (!pixPosition)
		return;
	this.div_.style.width = this.width_ + "px";
	this.div_.style.left = (pixPosition.x + this.offsetHorizontal_) + "px";
	this.div_.style.height = this.height_ + "px";
	this.div_.style.top = (pixPosition.y + this.offsetVertical_) + "px";
	this.div_.style.display = 'block';
};
//InfoBox.prototype.createElement = function() {
//	var panes = this.getPanes();
//	var div = this.div_;
//	if (!div) {
//		div = this.div_ = document.createElement("div");
//		div.style.border = "0px none";
//		div.style.position = "absolute";
//		div.style.background = "url('http://127.0.0.1/miniyun/statics/web/images/infownd.png')";
//		div.style.width = this.width_ + "px";
//		div.style.height = this.height_ + "px";
//		var contentDiv = document.createElement("div");
//		contentDiv.innerHTML = this.content_;
//		function removeInfoBox(ib) {
//			return function() {
//				ib.setMap(null);
//			};
//		}
//		div.appendChild(contentDiv);
//		div.style.display = 'none';
//		panes.floatPane.appendChild(div);
//	} else if (div.parentNode != panes.floatPane) {
//		div.parentNode.removeChild(div);
//		panes.floatPane.appendChild(div);
//	} else {
//	}
//}
InfoBox.prototype.panMap = function() {
	var map = this.map_;
	var bounds = map.getBounds();
	if (!bounds)
		return;
	var position = this.latlng_;
	var iwWidth = this.width_;
	var iwHeight = this.height_;
	var iwOffsetX = this.offsetHorizontal_;
	var iwOffsetY = this.offsetVertical_;
	var padX = 40;
	var padY = 40;
	var mapDiv = map.getDiv();
	var mapWidth = mapDiv.offsetWidth;
	var mapHeight = mapDiv.offsetHeight;
	var boundsSpan = bounds.toSpan();
	var longSpan = boundsSpan.lng();
	var latSpan = boundsSpan.lat();
	var degPixelX = longSpan / mapWidth;
	var degPixelY = latSpan / mapHeight;
	var mapWestLng = bounds.getSouthWest().lng();
	var mapEastLng = bounds.getNorthEast().lng();
	var mapNorthLat = bounds.getNorthEast().lat();
	var mapSouthLat = bounds.getSouthWest().lat();
	var iwWestLng = position.lng() + (iwOffsetX - padX) * degPixelX;
	var iwEastLng = position.lng() + (iwOffsetX + iwWidth + padX) * degPixelX;
	var iwNorthLat = position.lat() - (iwOffsetY - padY) * degPixelY;
	var iwSouthLat = position.lat() - (iwOffsetY + iwHeight + padY) * degPixelY;
	var shiftLng = (iwWestLng < mapWestLng ? mapWestLng - iwWestLng : 0)
			+ (iwEastLng > mapEastLng ? mapEastLng - iwEastLng : 0);
	var shiftLat = (iwNorthLat > mapNorthLat ? mapNorthLat - iwNorthLat : 0)
			+ (iwSouthLat < mapSouthLat ? mapSouthLat - iwSouthLat : 0);
	var center = map.getCenter();
	var centerX = center.lng() - shiftLng;
	var centerY = center.lat() - shiftLat;
	map.setCenter(new google.maps.LatLng(centerY, centerX));
	google.maps.event.removeListener(this.boundsChangedListener_);
	this.boundsChangedListener_ = null;
};